import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp1 extends StatelessWidget {
  // final List items;
  // MyApp1({Key key, @required this.items}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    // print(items);

    return MaterialApp(
      title: 'myApp',
      home: Scaffold(
        appBar: AppBar(
          title: Text('我是新页面哦'),
        ),
        body: Container(
          child: List(),
          color: Colors.red,
          width: 375.0,
          height: 300.0,
          // padding: const EdgeInsets.all(10.0),
        ),
      ),
    );
  }
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'myApp',
      home: Scaffold(
        appBar: AppBar(
          title: Text('myapp3'),
        ),
        body: new Column(
          children: <Widget>[
            Container(
              height: 200.0,
              child: List(),
            ),
            MyGridView(),
            Container(
              height: 200.0,
              child: ImageBox(),
            )
          ],
        ),
      ),
    );
  }
}

class MyGridView extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GridView.count(
      padding: const EdgeInsets.all(10.0),
      crossAxisSpacing: 10.0,
      mainAxisSpacing: 10.0,
      crossAxisCount: 3,
      shrinkWrap: true,
      children: <Widget>[
        InkWell(
          child: Container(
            width: 400.0,
            height: 200.0,
            alignment: Alignment.center,
            color: Color.fromARGB(55, 255, 0, 255),
            child: Text('盒子1djsfhsda'),
          ),
          onTap: () {
            print('1111111111111111111111');
            Navigator.push(context,
                new MaterialPageRoute(builder: (context) => new MyApp1()));
          },
        ),
        Container(
          width: 400.0,
          height: 200.0,
          color: Color.fromARGB(55, 255, 100, 255),
          alignment: Alignment.bottomCenter,
          child: Text('盒子1'),
        ),
        Container(
          width: 400.0,
          height: 200.0,
          alignment: Alignment.topCenter,
          color: Color.fromARGB(55, 255, 100, 255),
          child: Text('盒子1'),
        ),
        Container(
          width: 400.0,
          height: 200.0,
          alignment: Alignment.center,
          color: Color.fromARGB(55, 255, 0, 255),
          child: Text('盒子1djsfhsda'),
        ),
        Container(
          width: 400.0,
          height: 200.0,
          color: Color.fromARGB(55, 255, 100, 255),
          alignment: Alignment.topLeft,
          child: Text('盒子1'),
        ),
        Container(
          width: 400.0,
          height: 200.0,
          alignment: Alignment.bottomRight,
          color: Color.fromARGB(55, 255, 100, 255),
          child: Text('盒子1'),
        ),
      ],
    );
  }
}

class ImageBox extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: 200.0,
      height: 300.0,
      child: Image.network(
          "https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=233301930,3031623456&fm=11&gp=0.jpg"),
      decoration: BoxDecoration(
          gradient: const LinearGradient(
              colors: [Colors.lightBlue, Colors.greenAccent, Colors.purple])),
    );
  }
}

class List extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ListView(
      scrollDirection: Axis.horizontal,
      shrinkWrap: true,
      children: [
        // ListTile(
        //     leading: new Icon(Icons.access_time),
        //     title: new Text('access_time')),
        Image.network(
            "https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=233301930,3031623456&fm=11&gp=0.jpg"),
        Image.network(
            "https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=233301930,3031623456&fm=11&gp=0.jpg"),
        Image.network(
            "https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=233301930,3031623456&fm=11&gp=0.jpg"),
        Image.network(
            "https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=233301930,3031623456&fm=11&gp=0.jpg"),
        // Text('data')
      ],
    );
  }
}
